package com.hnucm.springboot.springboot.controller;

import com.hnucm.springboot.springboot.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class JSONController {
    // ResponseBody 返回结果为json格式（String）
    @ResponseBody
    @RequestMapping("/getuser")
    public User test(){
        User user = new User();
        user.setId(1);
        user.setName("张三");
        user.setAge(20);
        return user;
    }
}
